COMMON_PARAM=--stringparam sqlzen $(SQLZEN) --stringparam lang ko

all: sql graph html

sql:
	xsltproc --stringparam vendor mysql $(COMMON_PARAM) --xinclude $(SQLZEN)\stylesheet\sql.xsl project.xml > project.sql

html:
	xsltproc --xinclude $(COMMON_PARAM) $(SQLZEN)\stylesheet\html.xsl project.xml > project.html

graph: graph-tables graph-erd

graph-tables:
	xsltproc --xinclude $(COMMON_PARAM) $(SQLZEN)\stylesheet\graph-tables.xsl project.xml > project-tables.dotml
	xmllint --noout --relaxng $(SQLZEN)\external\schema\dotml.rng project-tables.dotml
	xsltproc --xinclude $(COMMON_PARAM )$(DOTML)\stylesheet\dot.xsl project-tables.dotml > project-tables.dot
	dot -Tsvg project-tables.dot -o project-tables.svg

graph-erd:
	xsltproc --xinclude $(COMMON_PARAM) $(SQLZEN)\stylesheet\graph-erd.xsl project.xml > project-erd.dotml
	xmllint --noout --relaxng $(SQLZEN)\external\schema\dotml.rng project-erd.dotml
	xsltproc --xinclude $(COMMON_PARAM) $(DOTML)\stylesheet\dot.xsl project-erd.dotml > project-erd.dot
	dot -Tsvg project-erd.dot -o project-erd.svg -Kfdp

clean:
	del *.html
	del *.sql
	del *.dotml
	del *.dot
	del *.svg
	del *.png

